import {createAction, createThunkAction} from "../../lib/redux-utils";
import {get, postJson} from "../../lib/http";
import {getPrincipal} from "../../lib/identity";

const principal = getPrincipal();
export const showCreate = createAction("RATE.SHOW_CREATE");
export const hideCreate = createAction("RATE.HIDE_CREATE");
export const showModify = createAction("RATE.SHOW_MODIFY");
export const hideModify = createAction("RATE.HIDE_MODIFY");
export const updateModel = createAction("RATE.UPDATE");

export const query = createThunkAction("RATE.QUERY", () =>
    get("/rate/getCommon")
);
export const modify = createThunkAction("RATE.MODIFY", params =>
    postJson("/rate/update", params)
);
export const create = createThunkAction("RATE.CREATE", params =>
    postJson("/rate/create", params)
);
export const del = createThunkAction("", params =>
    get("/rate/delete/" + params+"/"+principal.id)
);

